from rest_framework import serializers
from users.models import User

class UserSerializer(serializers.Serializer):
    # 额外增加 mobile 字段
    id = serializers.IntegerField(label='ID', read_only=True)
    mobile = serializers.CharField(max_length=11,
                              label='手机号')

    # 新增 email_active 字段
    # 用于记录邮箱是否激活, 默认为 False: 未激活
    email_active = serializers.BooleanField(default=False,
                                       label='邮箱验证状态')
    # 新增
    # default_address = UserSerializer()
    # default_address = serializers.F('Address',
    #                                     related_name='users',
    #                                     null=True,
    #                                     blank=True,
    #                                     on_delete=serializers.SET_NULL,
    #                                     verbose_name='默认地址')

# class UserRegisterSerializer(serializers.Serializer):
#     username = serializers.CharField()
#     password = serializers.CharField()
#     password2 = serializers.CharField()
#     mobile = serializers.IntegerField()
#     sms_code_client = serializers.IntegerField()